<!DOCTYPE html>
<html>
  <meta charset="UTF-8" />

  <head>
    <script src="https://wmskr-erps.oss-cn-hangzhou.aliyuncs.com/doc/jquery.min.js"></script>

    <!-- <script src="https://wmskr-erps.oss-cn-hangzhou.aliyuncs.com/doc/translate.min.js"></script> -->
  </head>

  <body>
    <form action="https://secure.oceanpayment.com/gateway/service/pay" method="post" id="checkout_creditcard" style="display: none;">
      account <input name="account" type="hidden" value="" id="account" /> terminal <input name="terminal" type="hidden" value="" id="terminal" /> order_number <input name="order_number" type="hidden" value="" id="order_number" /> order_currency<input
        name="order_currency"
        type="hidden"
        value=""
        id="order_currency"
      />
      order_amount<input name="order_amount" type="hidden" value="" id="order_amount" /> signValue<input name="signValue" type="hidden" value="" id="signValue" /> backUrl <input name="backUrl" type="hidden" value="" id="backUrl" /> noticeUrl
      <input name="noticeUrl" type="hidden" value="" id="noticeUrl" /> methods<input name="methods" type="hidden" value="" id="methods" /> billing_firstName <input name="billing_firstName" type="hidden" value="" id="billing_firstName" /> billing_lastName<input
        name="billing_lastName"
        type="hidden"
        value=""
        id="billing_lastName"
      />
      billing_email <input name="billing_email" type="hidden" value="" id="billing_email" /> billing_phone <input name="billing_phone" type="hidden" value="" id="billing_phone" /> billing_country<input name="billing_country" type="hidden" value="" id="billing_country" /> billing_city
      <input name="billing_city" type="hidden" value="" id="billing_city" /> billing_address <input name="billing_address" type="hidden" value="" id="billing_address" /> billing_zip <input name="billing_zip" type="hidden" value="" id="billing_zip" /> productSku
      <input name="productSku" type="hidden" value="" id="productSku" /> productPrice <input name="productPrice" type="hidden" value="" id="productPrice" /> productName <input name="productName" type="hidden" value="" id="productName" /> productNum<input
        name="productNum"
        type="hidden"
        value=""
        id="productNum"
      />
    </form>
    <button onclick="pay()" class="btn-cs" style="display: none;">确定支付</button>
    <script type="text/javascript">
      // window.addEventListener(
      //   'message',
      //   e => {
      //     if (e.data) {
      //       const formData = JSON.parse(e.data)
      //       console.log('🤡 ~ e:', e.data)
      //       localStorage.setItem('formData', e.data)
      //     }
      //   },
      //   true
      // )

      function pay() {
        $('#checkout_creditcard').submit()
      }

      // 接口的URL地址
      // localStorage.setItem('formData', JSON.stringify(
      //   { "account": "995183", "terminal": "99518307", "order_number": "1714032560781598079", "order_currency": "KRW", "order_amount": 15000, "methods": "KOR_Credit Card", "billing_lastName": "13999999999", "billing_firstName": "13999999999", "billing_email": "13999999999@www.tke.kr.com", "billing_phone": "", "key": "/", "backUrl": "https://www.tke.kr/user/indent/detail?id=138", "noticeUrl": "https://admin.drk88.com/api/v1/app/paymentNotify", "billing_country": "KR", "billing_state": "11", "productSku": "test", "productName": "수도쿠 옥수수 섬유 칫솔 세트", "productNum": 1, "productPrice": 15000, "signValue": "2b8c5ccce449a2599ff4fe6c7070e0501a90ae880d4e07f952262ba1ceed5bbe" }
      // ))
      const params = new URLSearchParams(window.location.search)
      console.log('🤡 ~ params:', params)
      const data =params.get('data')
    
      if (false) {
        const formData = JSON.parse(data)
        console.log("🤡 ~ formData:",formData.account )
        $('#account').val(formData.account)
        $('#element').html(formData.account )
        $('#terminal').val(formData.terminal)
        $('#order_amount').val(formData.order_amount)
        $('#order_number').val(formData.order_number)
        $('#order_currency').val(formData.order_currency)
        $('#signValue').val(formData.signValue)
        $('#backUrl').val(formData.backUrl)
        $('#noticeUrl').val(formData.noticeUrl)
        $('#productPrice').val(formData.productPrice)
        $('#methods').val(formData.methods)
        $('#billing_firstName').val(formData.billing_firstName)
        $('#billing_lastName').val(formData.billing_lastName)
        $('#billing_email').val(formData.billing_email)
        $('#billing_phone').val(formData.billing_phone)
        $('#billing_country').val(formData.billing_country)
        $('#billing_city').val(formData.billing_city)
        $('#billing_address').val(formData.billing_address)
        $('#billing_zip').val(formData.billing_zip)
        $('#productSku').val(formData.productSku)
        $('#productName').val(formData.productName)
        $('#productNum').val(formData.productNum)
        pay()
      }

      if (localStorage.getItem('formData')) {
        const formData = JSON.parse(localStorage.getItem('formData'))
        // $("#checkout_creditcard").attr('action',formData.actionurl);
        $('#account').val(formData.account)
        $('#terminal').val(formData.terminal)
        $('#order_amount').val(formData.order_amount)
        $('#order_number').val(formData.order_number)
        $('#order_currency').val(formData.order_currency)
        $('#signValue').val(formData.signValue)
        $('#backUrl').val(formData.backUrl)
        $('#noticeUrl').val(formData.noticeUrl)
        $('#productPrice').val(formData.productPrice)
        $('#methods').val(formData.methods)
        $('#billing_firstName').val(formData.billing_firstName)
        $('#billing_lastName').val(formData.billing_lastName)
        $('#billing_email').val(formData.billing_email)
        $('#billing_phone').val(formData.billing_phone)
        $('#billing_country').val(formData.billing_country)
        $('#billing_city').val(formData.billing_city)
        $('#billing_address').val(formData.billing_address)
        $('#billing_zip').val(formData.billing_zip)
        $('#productSku').val(formData.productSku)
        $('#productName').val(formData.productName)
        $('#productNum').val(formData.productNum)
        pay()

        // $(document).ready(function () {
        // $('#checkout_creditcard').submit();
        // });
      }
    </script>

    <!-- <script src="https://translate.google.com/translate_a/element.js?cb=googleTranslateElementInit"></script> -->
  </body>
</html>
